#include <iostream>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

int calcRet(const vector<string>& words, const string& dest) {
    int ret = 0;
    unordered_map<char, int> hashChar; 
    int cntQuestion = 0;

    for (char c : dest) {
        hashChar[c]++;
        if (c == '?') {
            cntQuestion++;
        }
    }

    for (const string& word : words) {
        unordered_map<char, int> wordCount;
        int tmp = 0;

        for (char c : word) {
            wordCount[c]++;
        }

        for (char c : word) {
            if (wordCount[c] > hashChar[c]) {
                tmp -= hashChar[c] - wordCount[c];
                wordCount[c] = 0;
            }
        }

        if (tmp == 0 || cntQuestion - tmp >= 0) {
            ret++;
        }
    }

    return ret;
}

int main() {
    // 获取数据
    int n = 0;
    cin >> n;

    vector<string> words(n);
    for (int i = 0; i < n; ++i) {
        cin >> words[i];
    }

    string dest;
    cin >> dest;

    // 获取好数据对数据进行计算操作
    int retVal = calcRet(words, dest);
    cout << retVal << endl;

    return 0;
}
